package com.example.pei.ithinklearnt.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.pei.ithinklearnt.R;
import com.example.pei.ithinklearnt.adapter.base.BaseRecyclerAdapter;
import com.example.pei.ithinklearnt.adapter.base.BaseRecyclerHolder;
import com.example.pei.ithinklearnt.bean.UserInfo;
import com.example.pei.ithinklearnt.bean.UserSkill;
import com.example.pei.ithinklearnt.view.base.IMutlipleItem;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static com.example.pei.ithinklearnt.utils.MyUtils.getAge;

/**
 * Created by Pei on 2018/4/12.
 */

public class MatchedUserAdapter extends BaseRecyclerAdapter<UserSkill> {

    public MatchedUserAdapter(Context context, IMutlipleItem<UserSkill> items, Collection<UserSkill> datas) {
        super(context, items, datas);
    }

    @Override
    public void bindView(BaseRecyclerHolder holder, UserSkill item, int position) {

        //设置 用户名
        holder.setText(R.id.tv_username,item.getUser().getNickName());
        //设置头像
        holder.setImageView(item.getUser().getHeadFileUrl(), R.drawable.default_head, R.id.rv_head);
        //设置擅长的技能
        StringBuilder can= new StringBuilder("擅长：");
        ArrayList<String> strongs= (ArrayList<String>) item.getStrongSkills();
        if(strongs!=null){
            for(String s:strongs){
                can.append(s).append(" ");
            }
        }else{
            can.append("此人啥都不会...还是算了吧 (ㅍ_ㅍ)");
        }

        holder.setText(R.id.tv_ican, can.toString());
        //设置匹配值
        holder.setText(R.id.match_point,"匹配值："+item.weight+"%");
    }
}
